﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Net_SCADA
{
    class netForms
    {
        public static Dictionary<int,string[]> MenuBtn=new Dictionary<int, string[]>()
        {
            {0,new string[2]{ "设备总览", "Equip Monitor" } },
            {1,new string[2]{ "工艺设计" , "Parameter Design" } },
            {2,new string[2]{ "执行工艺" , "Execution Parameter" } },
            {3,new string[2]{ "警报显示" , "Alarm" } },
            {4,new string[2]{ "系统设定" , "Settings" } },
            {5,new string[2]{ "设备参数" , "Other Equip Parameter" } },
            {6,new string[2]{ "历史记录" , "History" } },
            {7,new string[2]{ "用户登陆" , "User Login" } },
            {8,new string[2]{ "退出控制" , "Exit System" } }
        };

        public static Font ft=new Font("宋体",10.5f,FontStyle.Regular);
        public static Size sz=new Size(150,50);

        private static List<Form> FormList = new List<Form>();
        public static Form_BG fmbg = new Form_BG();
        public static Form_Top fmTop = new Form_Top();
        public static Form_Exit fmExit = new Form_Exit();
        public static Form_Login fmLogin = new Form_Login();
        public static Form_Menu fmMenu=new Form_Menu();
        public static Form_Settings fmSetting=new Form_Settings();
        public static Form_Run fmRun=new Form_Run();
        public static Form_Design fmDesign=new Form_Design();
        public static Form_Monitor fmMoniter=new Form_Monitor();
        public static Form_Alarm fmAlarm=new Form_Alarm();
      //  public static Form_History fmHistory=new Form_History();
        public static Form_MessageBox fmMsgBox = null;
        public static Form_ProcessBox fmPbox = null;
        public static Form_LimitSet fmLmt=new Form_LimitSet();
        private static Point _zeroPoint = new Point(6,6);
        public static Point ZeroPoint { get { return _zeroPoint; } }
        private static int _formindex;
        public static int bgWidth { get; set; }
        public static int bgHeight { get; set;}
        public static int Formindex
        {
            get { return _formindex; }
            set
            {
                _formindex = value;
                for (int i = 0 ; i < FormList.Count ; i++)
                {
                    if (i != value)
                    {
                        FormList[i].Hide();
                    }
                }
                FormList[value].Show();
                FormList[value].BringToFront();
                fmbg.Activate();
            }
        }
        public static void showLogin(int loginIndex)
        {
            if (fmLogin== null || fmLogin.IsDisposed) 
                fmLogin = new Form_Login();
            fdUsers.LoginIndex = loginIndex;
            fmLogin.ShowDialog();
           
        }
        public static void showFormExit()
        {
            if (fmExit==null || fmExit.IsDisposed) fmExit = new Form_Exit();
            fmExit.ShowDialog();
        }
        public static void SetPostionAndSize(Form fm)
        {
            fm.Location = new Point(ZeroPoint.X , ZeroPoint.Y + 60);
            fm.Size = new Size(bgWidth , bgHeight - 60);
        }
        public static void SetForms()//将新的界面放到fmfather里面
        {
            fmTop.MdiParent = fmbg;
            fmMoniter.MdiParent = fmbg;
            fmSetting.MdiParent = fmbg;
            fmDesign.MdiParent = fmbg;
            fmRun.MdiParent = fmbg;
            fmAlarm.MdiParent = fmbg;
            fmLmt.MdiParent = fmbg;
          //  fmHistory.MdiParent = fmbg;
            FormList.Add(fmMoniter);//0
            FormList.Add(fmDesign);//1
            FormList.Add(fmRun);//2
            FormList.Add(fmAlarm) ;//3
            FormList.Add(fmSetting);//4
            FormList.Add(fmLmt);//5
          //  FormList.Add(fmHistory);//6
        }
    }
}
